package net.alcuria.ball;

import net.alcuria.framework.Music;
import net.alcuria.framework.Sound;
import net.alcuria.framework.gl.Animation;
import net.alcuria.framework.gl.Texture;
import net.alcuria.framework.gl.TextureRegion;
import net.alcuria.framework.impl.GLGame;

public class Assets {
	//	public static Pixmap background;
	//	public static Pixmap sky;
	//	public static Pixmap parallax;
	//	public static Pixmap foreground;
	//	public static Pixmap button;
	//	public static Pixmap sound;
	//	public static Pixmap tileset;
	//	public static Pixmap ball;
	//	public static Pixmap character;

	public static Texture glBackground;
	public static TextureRegion glBackgroundRegion;

	public static Texture glItems;
	public static Animation mainMenu;
	public static TextureRegion soundOn;
	public static TextureRegion soundOff;
	
	public static Texture glParallax;
	public static TextureRegion parallaxSky;
	public static TextureRegion parallaxTrees;
	public static TextureRegion parallaxForeground;
	
	public static Texture glTileset;
	public static TextureRegion[] tileset;

	//	public static Pixmap sparkle;
	//	public static Pixmap splash;
	//	public static Pixmap crumble;
	//	public static Pixmap dust;
	//	public static Pixmap powerupSprite;
	//	public static Pixmap iceBreak;

	public static Sound click;
	public static Sound press;
	public static Sound jump;
	public static Sound chomp;
	public static Sound water;
	public static Sound land;
	public static Sound powerup;
	public static Sound breaks;
	public static Sound ice;
	public static Sound hiss;
	public static Sound spring;

	public static Music elysium;
	public static Music world1;

	public static Map map;

	public static void load(GLGame game) {
		glBackground = new Texture(game, "sprite/glbackground.png");
		glBackgroundRegion = new TextureRegion(glBackground, 0, 0, 32, 32);

		// load interface elements
		glItems = new Texture(game, "sprite/glitems.png");
		mainMenu = new Animation(0.2f,
				new TextureRegion(glItems, 64, 0, 256, 64),
				new TextureRegion(glItems, 64, 64, 256, 64));
		soundOn = new TextureRegion(glItems, 0, 0, 64, 64);
		soundOff = new TextureRegion(glItems, 0, 64, 64, 64);

		// load parallax elements
		glParallax = new Texture(game, "background/glparallax.png");
		parallaxSky = new TextureRegion(glParallax,0,0,512,301);
		parallaxTrees = new TextureRegion(glParallax,0,301,512,244);
		parallaxForeground = new TextureRegion(glParallax, 0, 545, 420, 158);
				

		// load sounds
		click = game.getAudio().newSound("sound/click.wav");
		elysium = game.getAudio().newMusic("music/elysium.ogg");
		
		// load map
		map = new Map("map/testmap.cmf", game.getFileIO().getAssets());
		
		// load tileset elements
		glTileset = new Texture(game, "tileset/gltileset.png");
		tileset = new TextureRegion[161];
		for(int i = 0; i < 20; i++){
			for(int j = 0; j < 8; j++){
				tileset[8*i + j] = new TextureRegion(glTileset, j * 32, i * 32, 32, 32);
			}
		}
		
	}

	public static void reload() {
		glBackground.reload();
		glParallax.reload();
		glTileset.reload();
		glItems.reload();

	}

}
